//
//  ADNaviRouteInfo.m
//  Anda_Driver_Pro
//
//  Created by AnDa-Y on 2019/8/7.
//  Copyright © 2019 AnDa-Y. All rights reserved.
//

#import "ADNaviRouteInfo.h"
#import "ADLocationModel.h"

@implementation ADNaviRouteInfo
- (NSString *)routeInfo
{
    if (!_routeInfo) {
        _routeInfo = [NSString stringWithFormat:@"总里程%.3f 公里,大约需要%ld分%ld秒,起点经纬度:{%f,%f},终点经纬度:{%f,%f}",self.routeLength / 1000.0,(long)self.routeTime / 60,(long)self.routeTime % 60,self.startLoc.latitude,self.startLoc.longitude,self.endLoc.latitude,self.endLoc.longitude];
    }
    return _routeInfo;
}
@end

@implementation ADNaviRouteInfo (RemainCalculate)
- (NSString *)remainNaviDistance
{
    // 路程,公里
    double remainDistance = self.routeRemainDistance / 1000.00;
    if (remainDistance < 1) {
        return [NSString stringWithFormat:@"%.f米" , remainDistance * 1000];
    }else {
        return [NSString stringWithFormat:@"%.2f公里" , remainDistance];
    }
}

- (NSString *)remainNaviTime
{
    // 时间,分钟
    CGFloat needTime = self.routeRemainTime / 60.0;
    if(needTime < 1) needTime = 1;
    return [NSString stringWithFormat:@"%.f分钟" , needTime];
}
@end
